import cv2
import numpy as np

q = cv2.imread("../asset/q.jpg")
h, w, ch = q.shape
print(q.shape)
# 能实现图片倾斜
src = np.float32([[132, 10], [690, 10], [132, 800], [690, 800]])
dst = np.float32([[0, 0], [690, 0], [0, 668], [690, 668]])
M = cv2.getPerspectiveTransform(src, dst)
new_img = cv2.warpPerspective(q, M, (690, 668))
print(new_img.shape)
while True:
    cv2.imshow('new_img', new_img)
    cv2.imshow('q', q)
    key = cv2.waitKey(10)
    if key & 0xFF == ord('q'):
        break

cv2.destroyAllWindows()
